﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YXShop.IDAL.Product;
using YXShop.DALFactory;
using System.Data;

namespace YXShop.BLL.Product
{
    public class ProductType
    {
         private readonly IProductType dal = DataAccess.CreateProductType();
         public ProductType()
        { }
        #region  成员方法
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(YXShop.Model.Product.ProductType model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(YXShop.Model.Product.ProductType model)
        {
            return dal.Update(model);
        }
        /// <summary>
        /// 更新一条数据(商品参数)
        /// </summary>
        public int UpdateProductParameter(YXShop.Model.Product.ProductTypeParameter model, int productTypeId)
        {
            return dal.UpdateProductParameter(model,productTypeId);
        }

        /// <summary>
        /// 更新一条数据(用户购买必需项)
        /// </summary>
        public int UpdateProductBuySet(YXShop.Model.Product.ProductTypeBuySet model, int productTypeId)
        {
            return dal.UpdateProductBuySet(model,productTypeId);
        }

        public void AddProductProperty(YXShop.Model.Product.ProductTypeProperty model)
        {
            dal.AddProductProperty(model);
        }
        /// <summary>
        /// 增加商品类型（商品参数）
        /// </summary>
        /// <param name="model"></param>
        public void AddProductParameter(YXShop.Model.Product.ProductTypeParameter model)
        {
            dal.AddProductParameter(model);
        }
        /// <summary>
        /// 增加商品类型（用户购买必需项）
        /// </summary>
        /// <param name="model"></param>
        public void AddProductBuySet(YXShop.Model.Product.ProductTypeBuySet model)
        {
            dal.AddProductBuySet(model);
        }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(int Id)
        {
            dal.Delete(Id);
        }
        /// <summary>
        /// 删除商品属性的一条数据
        /// </summary>
        public void DeleteProductProperty(int id, int productTypeId)
        {
            dal.DeleteProductProperty(id, productTypeId);
        }

        /// <summary>
        /// 删除一条数据(商品参数)
        /// </summary>
        public int DeleteProductParameter(int id, int productTypeId)
        {
            return dal.DeleteProductParameter(id, productTypeId);
        }
         /// <summary>
        /// 删除一条数据(用户必需项)
        /// </summary>
        public int DeleteProductBuySet(int id, int productTypeId)
        {
            return dal.DeleteProductBuySet(id, productTypeId);
        }
        public int Amend(int id, string columnName, Object value)
        {
            return dal.Amend(id, columnName, value);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public YXShop.Model.Product.ProductType GetModel(int id)
        {

            return dal.GetModel(id);
        }

        public int UpdateProductProperty(YXShop.Model.Product.ProductTypeProperty model, int productTypeId)
        {
            return dal.UpdateProductProperty(model, productTypeId);
        }
        /// <summary>
        /// 获取属性表名与品牌
        /// </summary>
        /// <param name="cid">商品分类ID</param>
        /// <returns></returns>
        public DataTable GetProductTypeBrandAndProperty(int cid)
        {
            return dal.GetProductTypeBrandAndProperty(cid);
        }
        /// <summary>
        /// 商品类型商品属性得到一个对象实体(商品参数)
        /// </summary>
        public YXShop.Model.Product.ProductTypeParameter GetProductParameterModel(int Id, int productTypeId)
        {
            return dal.GetProductParameterModel(Id,productTypeId);
        }
        /// <summary>
        /// 商品类型商品属性得到一个对象实体(用户购买必需项)
        /// </summary>
        public YXShop.Model.Product.ProductTypeBuySet GetProductBuySetModel(int Id, int productTypeId)
        {
            return dal.GetProductBuySetModel(Id,productTypeId);
        }
        public YXShop.Model.Product.ProductTypeProperty GetProductPropertyModel(int id, int productTypeId)
        {
            return dal.GetProductPropertyModel(id, productTypeId);
        }
        /// <summary>
        /// 所有数据
        /// </summary>
        /// <returns></returns>
        public ChangeHope.DataBase.DataByPage GetList()
        {
            return dal.GetList();
        }
         /// <summary>
        /// 根据条件得到列表(商品类型)
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public List<YXShop.Model.Product.ProductType> GetAllByWhere(string strWhere)
        {
            return dal.GetAllByWhere(strWhere);
        }
        /// <summary>
        /// 商品类型商品(属性查询)
        /// </summary>
        /// <returns></returns>
        public ChangeHope.DataBase.DataByPage GetProductPropertyList(int id)
        {
            return dal.GetProductPropertyList(id);
        }
        /// <summary>
        /// 根据条件得到List列表(商品属性)
        /// </summary>
        /// <param name="productTypeId"></param>
        /// <returns></returns>
        public List<YXShop.Model.Product.ProductTypeProperty> GetProductPropertyAllByWhere(int productTypeId, string strWhere)
        {
            return dal.GetProductPropertyAllByWhere(productTypeId, strWhere);
        }
        /// <summary>
        /// 根据条件得到List列表(商品参数)
        /// </summary>
        /// <param name="productTypeId"></param>
        /// <returns></returns>
        public List<YXShop.Model.Product.ProductTypeParameter> GetProductParameterAllByWhere(int productTypeId, string strWhere)
        {
            return dal.GetProductParameterAllByWhere(productTypeId, strWhere);
        }
        /// <summary>
        /// 商品类型(商品参数)
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ChangeHope.DataBase.DataByPage GetProductParameterList(int id, int SeriesId)
        {
            return dal.GetProductParameterList(id, SeriesId);
        }
        /// <summary>
        /// 商品类型(用户购买必需项)
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ChangeHope.DataBase.DataByPage GetProductBuySetList(int id)
        {
            return dal.GetProductBuySetList(id);
        }
        #endregion  成员方法
    }
}
